package demo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class Poker {
    public static void main(String[] args) {
        List<String> pokers = new ArrayList<>();

        String[] color = new String[] {"♥", "♠", "♣", "♦"};
        String[] number = new String[] {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
        for (String c : color) {
            for (String n : number) {
                pokers.add(c + n);
            }
        }
        pokers.add("King");
        pokers.add("Quene");

        // 洗牌
        Collections.shuffle(pokers);

        // 发牌
        List<String> play1 = new ArrayList<>();
        List<String> play2 = new ArrayList<>();
        List<String> play3 = new ArrayList<>();
        List<String> bottom = new ArrayList<>();
        for (int i = 0; i < pokers.size(); i++) {
            if (i < 3) {
                bottom.add(pokers.get(i));
            } else {
                if (i % 3 == 0) {
                    play1.add(pokers.get(i));
                }
                if (i % 3 == 1) {
                    play2.add(pokers.get(i));
                }
                if (i % 3 == 2) {
                    play3.add(pokers.get(i));
                }
            }
        }
        lookLookPoker("张三", play1);
        lookLookPoker("李四", play2);
        lookLookPoker("王五", play3);
        lookLookPoker("底牌", bottom);
    }

    private static void lookLookPoker(String name, List<String> play) {
        System.out.println(name + "的牌是：");
        for (String p : play) {
            System.out.print(p + "\t");
        }
        System.out.println();
    }
}
